<script type='text/javascript'>
    $(function() {
        $('#start_date').datepicker({
            changeMonth: true,
            changeYear: true,
            dateFormat: 'yy-mm-dd'
        });
    
        $('#end_date').datepicker({
            changeMonth: true,
            changeYear: true,
            dateFormat: 'yy-mm-dd'
        });
             
        Gift.changeGiftType();
        
    });
</script>	

<div class='center_form'>
    <!--div class="center_form_title">Add a department</div-->
    <div class="center_form_right">
        <div class='center_form_btn_div' onclick='javascript:Gift.saveGift();'>
            <div class='center_form_btn_pic'>
                <img src='<?php echo HttpUtil::baseUrl();?>/images/save.gif'/>
            </div><div class='center_form_btn_text'><?php echo $this->translate("saveBtn"); ?></div>
        </div>
       <?php 
        if(AAService::isAllowed("gift", "delete")){
        ?>
        <div class='center_form_btn_div' onclick='javascript:Common.deleteSubmit("<?php echo HttpUtil::baseUrl();?>/gift/gift/delete/id/<?php echo $this->id;?>")'>
            <div class='center_form_btn_pic'>
                <img src='<?php echo HttpUtil::baseUrl();?>/images/delete.gif'/>
            </div><div class='center_form_btn_text'><?php echo $this->translate("delBtn");?></div>
        </div>
        <?php }?>     
        <div class='center_form_btn_div' onclick='javascript:Common.gotoUrl("<?php echo HttpUtil::baseUrl();?>/gift/gift");'>
            <div class='center_form_btn_pic'>
                <img src='<?php echo HttpUtil::baseUrl();?>/images/cancel.gif'/>
            </div><div class='center_form_btn_text'><?php echo $this->translate("cancelBtn"); ?></div>
        </div>
    </div>
</div>
<div class="clear"></div>
<div class="centerbig_form">
      <div class="center_top"><span class="center_top_title"><?php echo $this->translate("editGiftTitle"); ?></span></div>
      <div class="right_form_content">
            <div class="centerbig_right">
               <div class="form_content">
                    <form action="<?php echo $this->form->getAction(); ?>" method="post" enctype="multipart/form-data"  id="gift_form" name="gift_form">
                      
                           <input type="hidden" name="gift_id" value="<?php echo $this->id; ?>" />
                           <?php ZendFormUtil::renderElement($this->form->gift_type,array("style"=>"width:180px;")); ?>
                           <div id="new_gift" >
                              <input type="hidden" id="old_image_name" name="old_image_name"  value="<?php echo $this->imagePath;?>" />
                              <?php ZendFormUtil::renderElement($this->form->title,array("style"=>"width:180px;")); ?>
                              <?php ZendFormUtil::renderElement($this->form->image,array("style"=>"width:180px;")); ?>
                              <div style="margin-left:185px; margin-bottom:5px; " >
                                 <img src="//pi.akimimi.com/gift/<?php echo $this->imagePath; ?>" width="60" height="60" alt="<?php echo $this->imagePath; ?>" />
                              </div>
                              <div class="clear"></div>
                              <?php ZendFormUtil::renderElement($this->form->description,array("style"=>"width:180px;")); ?>
                           </div>
                           <div id="product_select" >
                                <div style="margin-left:184px; margin-bottom:5px;" >
                                    <input type="button" value="<?php echo $this->translate("selProduct");?>" onclick="javascript:Gift.openProductDialog('<?php echo HttpUtil::baseUrl();?>');" />
                                </div>
                                <div class="clear" ></div>
                                <div id="product_info" >
                                <?php if($this->giftType == 1){?>
                                   <div class="form_line_div">
                                       <div class="form_element_label" style="width: 180px;"><?php echo $this->translate('productTitle');?></div>
                                       <div class="form_element" style="font-size:12px;color:#505050;"><?php echo $this->producTitle;?></div>
                                       <input type="hidden" name="product_item_id" value="<?php echo $this->productItemId;?>" id="product_item_id" />
                                       <input type="hidden" name="product_title" value="<?php echo $this->producTitle;?>" />
                                    </div>
                                    <div class="clear"></div>
                                <?php } ?>
                                </div>
                                <div class="form_line_div">
                                    <div id="productErrorLabel" class="form_element_label" style="width: 180px;"></div>
                                    <div id="productError" class="form_element_error"></div>
                                </div>
                                <div class="clear"></div>
                           </div>
                           <?php ZendFormUtil::renderElement($this->form->exhaust_point,array("style"=>"width:180px;")); ?>
                           <?php ZendFormUtil::renderElement($this->form->min_ac_point,array("style"=>"width:180px;")); ?>
                        
                           <?php ZendFormUtil::renderElement($this->form->start_date,array("style"=>"width:180px;")); ?>
                           <?php ZendFormUtil::renderElement($this->form->end_date,array("style"=>"width:180px;")); ?>
                       
                      
                    </form>
               </div>
            </div>
      </div>
      <div class='clear'></div>
</div>
<div class='clear'></div>

<div id="productDialog" ></div>

<input type="hidden" id="product_name" value="<?php echo $this->translate('productTitle');?>" />
<input type="hidden" id="product_empty" value="<?php echo $this->translate('productEmpty');?>" />
<input type="hidden" id="exhaust_point_empty" value="<?php echo $this->translate('exhaustPointEmpty');?>" />
<input type="hidden" id="exhaust_point_err" value="<?php echo $this->translate('exhaustPointErr')?>" />
<input type="hidden" id="min_ac_point_empty" value="<?php echo $this->translate('minACPointEmpty')?>" />
<input type="hidden" id="min_ac_point_err" value="<?php echo $this->translate('minACPointErr')?>" />
<input type="hidden" id="start_date_empty" value="<?php echo $this->translate('startDateEmpty')?>" />
<input type="hidden" id="end_date_empty" value="<?php echo $this->translate('endDateEmpty')?>" />
<input type="hidden" id="title_empty" value="<?php echo $this->translate('titleEmpty')?>" />
<input type="hidden" id="image_path_empty" value="<?php echo $this->translate('imagePathEmpty')?>" />